<?php

namespace app\common\model;

class Likes extends \think\Model
{
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    public static function isLike($id,$type='post'){
        if($user=User::info()){
            return self::where(['user_id'=>$user->id,'type'=>$type, 'like_id'=>$id])->find()?true:false;
        }
        return false;
    }
}